import * as actionTypes from "./actionTypes"
export default (state = [], action) => {
    switch (action.type) {
        case actionTypes.ADD_FLASH:
            console.log("xxxxxxxxxxxxxxx",state, action);
            return [
                ...state,
                action.payload

            ]
        case actionTypes.DEL_FLASH:
            const idx = state.findIndex(item => item.id === action.id)
            console.log(idx,state);
            return [
                ...state.slice(0, idx),
                ...state.slice(idx + 1),
            ]
        default:
            return state
    }
}